package com.iias.communication.util;

import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;

import java.net.InetSocketAddress;

public class SocketInfoUtils {


    public static String getHost(ChannelHandlerContext ctx){
        Channel channel = ctx.channel();
        InetSocketAddress socketAddress = (InetSocketAddress) channel.remoteAddress();
        return socketAddress.getAddress()+":"+socketAddress.getPort();
    }

    public static String getHost(Channel channel){
        InetSocketAddress socketAddress = (InetSocketAddress) channel.remoteAddress();
        return socketAddress.getAddress()+":"+socketAddress.getPort();
    }
}
